module.exports = {
  // 前端文件
  '**/*.{js,jsx,ts,tsx,mjs,cjs,vue,css,scss,sass,less,styl,html,htm}': (filenames) =>
    `npx prettier -w ${filenames.join(' ')}`,

  // 后端文件
  '**/*.{java,xml,properties}': (filenames) => `npx prettier -w ${filenames.join(' ')}`,

  // 配置文件
  '**/*.{yml,yaml,json,jsonc,json5}': (filenames) => `npx prettier -w ${filenames.join(' ')}`,
  '**/package.json': (filenames) => `npx prettier -w ${filenames.join(' ')}`,

  // 文档文件
  '**/*.{md,mdx,txt,text}': (filenames) => `npx prettier -w ${filenames.join(' ')}`,

  // 脚本文件
  '**/.env*': (filenames) => `npx prettier -w ${filenames.join(' ')}`,
  '**/*.{sh,bash,bat,cmd,ps1,sql}': (filenames) => `npx prettier -w ${filenames.join(' ')}`,

  // 构建和工程配置
  '**/Dockerfile*': (filenames) => `npx prettier -w ${filenames.join(' ')}`,
  '**/docker-compose*.yml': (filenames) => `npx prettier -w ${filenames.join(' ')}`,
  '**/*.{graphql,gql}': (filenames) => `npx prettier -w ${filenames.join(' ')}`,
  '**/{tsconfig.json,jsconfig.json}': (filenames) => `npx prettier -w ${filenames.join(' ')}`,
  '**/.{prettierrc,eslintrc,stylelintrc,babelrc}': (filenames) =>
    `npx prettier -w ${filenames.join(' ')}`,

  // IDE
  '.idea/**.xml': (filenames) => `npx prettier -w ${filenames.join(' ')}`,
  '.vscode/*.json': (filenames) => `npx prettier -w ${filenames.join(' ')}`,

  // 特殊文档
  '**/LICENSE': (filenames) => `npx prettier -w ${filenames.join(' ')}`,
  '**/README': (filenames) => `npx prettier -w ${filenames.join(' ')}`,
  '**/CHANGELOG': (filenames) => `npx prettier -w ${filenames.join(' ')}`,
  '**/CONTRIBUTING': (filenames) => `npx prettier -w ${filenames.join(' ')}`,

  '**/*.svg': (filenames) => `npx prettier -w ${filenames.join(' ')}`,
  '**/*.{d.ts,d.ts.map}': (filenames) => `npx prettier -w ${filenames.join(' ')}`,
  '**/*.{test,spec}.{js,jsx,ts,tsx}': (filenames) => `npx prettier -w ${filenames.join(' ')}`,
};
